package com.ruoyi.system.service.impl;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description: 测试多数据源
 * @author: MengW9
 * @create: 2019-11-28 10:39
 **/
@Service
public class DataSourceTestService {

    @Autowired
    private ISysUserService userService;

    public SysUser test1(Long userId) {
        return userService.selectById(userId);
    }


    @DataSource(value = DataSourceType.SLAVE)
    public SysUser test2(Long userId) {
        return userService.selectById(userId);
    }

}
